<?php
class SetCateDisplay extends Action {
	/* (non-PHPdoc)
	 * @see Action::execute()
	 */
	public function execute($params) {
		check_login ( ADMIN_LOGIN_PAGE );
		$cid = irqst ( 'cid' );
		$display = irqst ( 'display' );
		$display = $display > 0 ? 1 : 0;
		$data ['success'] = false;
		if (empty ( $cid )) {
			$data ['msg'] = '非法的栏目编号';
		} else {
			$cM = new WebPageCategory ();
			$rst = $cM->update ( array ('display' => $display ), $cid );
			if ($rst !== false) {
				$data ['success'] = true;
			} else {
				$data ['msg'] = '出错啦:' . $cM->last_error_msg ();
			}
		}
		return new JsonView ( $data );
	}
}